import { admincreateData } from "@/type/article"
import { admincreateChapterdata, admingetChaptersdata } from "@/type/chapter"
import request from "@/utils/request"

//管理员查询章节列表
export const admingetChapters=(data?:admingetChaptersdata)=>{
    return request({
        url:'/admin/chapters',
        method:'get',
        params:data
    })
}

//管理员查询章节详情
export const admingetChapterDetail=(id:string,data:admingetChaptersdata)=>{
    return request({
        url:`/admin/chapters/${id}`,
        method:'get',
        params:data
    })
}

//管理员创建章节
export const admincreateChapter=(data:admincreateChapterdata)=>{
    return request({
        url:'/admin/chapters',
        method:'post',
        data
    })
}

//管理员删除章节详情
export const admindeleteChapterDetail=(id:string,data:admingetChaptersdata)=>{
    return request({
        url:`/admin/chapters/${id}`,
        method:'delete',
        params:data
    })
}

//管理员更新章节详情
export const adminupdateChapterDetail=(id:string,params:admingetChaptersdata,data:admincreateData)=>{
    return request({
        url:`/admin/chapters/${id}`,
        method:'put',
        params,
        data
    })
}